package WaiBao;

import java.util.Arrays;

public class XuHaiLe {
    public static void main(String[] args) {
        String[] name = {"李大虎(班长)", "许褚(副班长)", "小李(学习委员)", "徐晃(组织委员)", "荀彧", "徐庶", "杨光", "杨之光", "孙尚香", "孙权", "孙策", "周瑜",
                "曹操", "曹丕", "曹植", "曹爽", "曹真", "诸葛亮", "诸葛瑾", "张飞", "关于", "张苞", "关心", "关平", "黄忠", "刘备", "刘表", "刘璋",
                "马超", "许海乐(学生)"};//考生本人:许海乐(学生)
        int[] age = {20, 21, 20, 19, 22, 20, 19, 21, 21, 19, 18, 18, 20, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 18, 20, 20};//考生本人年龄:20


        double[] aoteman1 = {78, 62, 76, 90, 97, 70, 78, 89, 81, 91, 91, 87, 85, 79, 65, 68, 99, 99, 96, 88, 92, 91, 95, 65, 75, 74, 94, 74, 80, 96};
        double[] aoteman2 = {77, 65, 65, 76, 88, 67, 68, 64, 70, 80, 92, 77, 66, 85, 65, 65, 76, 99, 76, 98, 72, 71, 95, 86, 75, 88, 84, 64, 81, 95};
        double[] aoteman3 = {62, 67, 84, 85, 75, 64, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 73, 71, 84, 95};


        double erjj1 ;//代表每个学生的总分
        double erji2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            dudu  =aoteman1[i] +aoteman2[i] +aoteman3[i];
//            heihei= (dudu * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + dudu);
//            System.out.println(name[i] + "的平均分为:" + heihei);
//        }


        double hezi1 = 0, hezi12 = 0;
        double[] shuru = new double[30];
//        for (int i = 0; i < 30; i++) {
//            hezi1= aoteman1[i] + aoteman2[i] + aoteman3[i];
//            hezi12 = (hezi1* 1.0) / 3;
//            shuru[i] = hezi12;
//        }
//
//        for (int i = 0; i < shuru.length - 1; i++) {
//            for (int j = 0; j <  shuru.length - i - 1; j++) {
//                if (shuru[j] <shuru[j + 1]) {
//                    double tep =  shuru[j];
//                    shuru[j] = shuru[j + 1];
//                    shuru[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println( shuru[i]);
//        }


        double shijian1 = 0,  shijian2 = 0, shijian3 = 0;//计算每门课的平均分
        double quan1 = 0,quan2 = 0, quan3 = 0;//计算每门课标准差
        double weixing1 = 0, weixing2 = 0, weixing3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i < aoteman1.length; i++) {
            he += aoteman1[i];
        }
        shijian1 = (he * 1.0) / 30;
        System.out.println("农业设施及环境调控的班级平均分为:" + shijian1);
        double Sum = 0;
        for (int i = 0; i < aoteman2.length; i++) {
            Sum +=aoteman2[i];
        }
        shijian2 = (Sum * 1.0) / 30;
        System.out.println("农业设施设计与建造的班级平均分为:" +  shijian2);
        double sum = 0;
        for (int i = 0; i <aoteman3.length; i++) {
            sum +=aoteman3[i];
        }
        shijian3 = (sum * 1.0) / 30;
        System.out.println("园艺植物设施栽培学的班级平均分为:" +  shijian3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i <aoteman1.length; i++) {
            c1 += (aoteman1[i] -  shijian1) * (aoteman1[i] -  shijian1);
        }
        quan1 = Math.sqrt(c1*1.0/30);
        System.out.println("农业设施及环境调控的班级标准差为:" + quan1);
        for (int i = 0; i < aoteman2.length; i++) {
            c2 += (aoteman2[i] -  shijian2) * (aoteman2[i] - shijian2);
        }
        quan2 = Math.sqrt(c2*1.0/30);
        System.out.println("农业设施设计与建造的班级标准差为:" +quan2);

        for (int i = 0; i <aoteman3.length; i++) {
            c3 += (aoteman3[i] -  shijian3) * (aoteman3[i] -  shijian3);
        }
        quan3 = Math.sqrt(c3*1.0/30);
        System.out.println("园艺植物设施栽培学的标准差为:" + quan3);
//////
//        Arrays.sort(aoteman1);
//        Arrays.sort(aoteman2);
//        Arrays.sort(aoteman3);
//        weixing1 = (aoteman1[15] + aoteman2[16]) * 1.0 / 2;
//        weixing2 = (aoteman2[15] +aoteman2[16]) * 1.0 / 2;
//        weixing3 = (aoteman3[15] + aoteman3[16]) * 1.0 / 2;
//        System.out.println("农业设施及环境调控的中位数为:" +  weixing1);
//        System.out.println("农业设施设计与制造的中位数为:" + weixing2);
//        System.out.println("园艺植物设施栽培学的中位数为:" +  weixing3);
//



    }
}
